<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBlindBoxRecordsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('blind_box_records', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->bigInteger('user_id')->index()->comment('用户ID');
            $table->bigInteger('order_id')->index()->comment('订单ID');
            $table->bigInteger('blind_box_id')->index()->comment('盲盒商品ID');
            $table->bigInteger('asset_product_id')->comment('资产对应的商品ID');
            $table->string('asset_token_id', 64)->comment('资产的存证ID');
            $table->dateTime('open_time')->nullable()->comment('盲盒开启时间');
            $table->bigInteger('user_asset_id')->nullable()->comment('用户资产ID');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('blind_box_records');
    }
}
